<template>
    <el-dialog class="elDialog" :title="wintitle" :visible.sync="isShow" width="32%" :lock-scroll="true">
        <el-form :model="order" label-width="80px">
            <el-form-item label="告警路径">
                <el-cascader :options="backstageData" :show-all-levels="false" :props="{ checkStrictly: true }" clearable
                    v-model="list" placeholder="筛选范围" @change="handleChange"></el-cascader>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submit">导出</el-button>
            </el-form-item>
        </el-form>
    </el-dialog>
</template>

<script>
import { mapState } from 'vuex'
import { requestApi, fileApi } from '@/requset/api'

export default {
    data() {
        return {
            wintitle: "导出告警",
            isShow: false,
            list: [],
            scoped_id: 0
        }
    },
    computed: {
        ...mapState('backstage', ['backstageData', 'deviceType']),
    },
    methods: {
        doOpen() {
            this.isShow = true
        },
        handleChange(e) {

            this.scoped_id = e[e.length - 1]
        },
        submit() {
            fileApi("post", "warn/download", { scoped_id: this.scoped_id, filename: "告警列表.xlsx" }, true).then(res => {

                if (res.code == 0) {
                    this.isShow = false
                    this.$message.success("导出成功")
                }
            })
        },

    }
}
</script>

<style></style>
